#include "DeviceHandler.h"
#include <string>

int main()
{
	try
	{
		DeviceHandler handler_(0);
		handler_.open();

		std::cout << handler_.get_details() << std::endl;;

		char tx_buffer[1] = {'A'};

		std::cout << "---" << std::endl << std::endl;

		std::cout << handler_.write(tx_buffer, sizeof(tx_buffer)) << " byte(s) written:" << std::endl << tx_buffer[0] << std::endl;

		char rx_buffer[256] = { 0 };

		FT_SetTimeouts(handler_.get_handle(), 5000, 0);
		std::cout << handler_.read(rx_buffer, 1) << " byte(s) received:" << std::endl << rx_buffer;

		handler_.close();
	}
	catch(std::exception &e)
	{
		std::cout << e.what();
	}
	std::cin.get();
}